<template>
  <div id="app">
    <Timer />

    <div>step:<input v-model.number="step" /></div>

    <div>time:<input v-model.number="time" /></div>

    <div>
      <select v-model="clock">
        <option value="1">计时器1</option>
        <option value="2">计时器2</option>
      </select>
      <button @click="change">修改</button>
    </div>
    <Clock title="定时器1" :step="clock1.step" :time="clock1.time" />
    <Clock title="定时器2" :step="clock2.step" :time="clock2.time" />
  </div>
</template>

<script>
import Timer from "./components/Timer.vue";
import Clock from "./components/Clock.vue";

export default {
  name: "App",
  components: {
    Timer,
    Clock,
  },
  data() {
    return {
      step: 1,
      time: 1000,
      clock1: {
        step: 1,
        time: 1000,
      },
      clock2: {
        step: 1,
        time: 1000,
      },
      clock: "1",
    };
  },
  methods: {
    change() {
      this[`clock${this.clock}`].step = this.step;
      this[`clock${this.clock}`].time = this.time;
    },
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
